< previous page page_15 next page >

Page 15
Note
The object of conventions is to make the application code easy to read and understand without inhibiting your natural creativity with excessive constraints and arbitrary restrictions. For this reason, the conventions suggested here are short and entirely voluntary. This section isn't attempting to tell you how your coding should look or be done; it's only making some suggestions.

The following code listing is a before example of a coded function:
Private Sub save_but_Click()
Screen.MousePointer = 11
noupd_ent = False
If new_but.Enabled = False Then
Set logset = logdb.CreateDynaset(cdt_tbl)
logset.FindFirst [first name] =  & fname.Text &  and [last name] =_
           & lname.Text & 
If Not logset.NoMatch Then
logset.Close
noupd_ent = True
Screen.MousePointer = 0
MsgBox Duplicate Candidate Name Entered
fname.SetFocus
Exit Sub
End If
logset.Close
End If
If data1.Recordset.EOF And data1.Recordset.BOF Then
norecs = True
Else
bk = data1.Recordset.BookMark
norecs = False
End If
If Len(lname.Text) = 0 Then
Screen.MousePointer = 0
MsgBox You Must Enter a First and Last Name., 32, setmsg
Exit Sub
End If
data1.Recordset.Update
loading = True
cdt_sel = data1.Recordset.Fields(cdt_id).Value
noupd_ent = False
Screen.MousePointer = 0
End Sub
When you enter code, the two easiest things that you can do are add comments to the code and consistently indent the code so that different logic blocks become obvious (for example, IfThenElseEnd If). Both conventions improve the overall

 
< previous page page_15 next page >

If you like this book, buy it!